package cn.itcast.controller;

import cn.itcast.exception.SysException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/*
* @PackageName:cn.itcast.controller
* @Class:UserController
* @author:ledehui
* @Date:2020/11/2 14:20
*/
@Controller
@RequestMapping("/user")
public class UserController  {

    @RequestMapping("/testException")
    public String testException()  throws SysException {
        System.out.println("testException...");
        try {

        //        模拟异常
            int a = 10/0;
        }catch (Exception e) {
            e.printStackTrace();
            throw  new SysException("查询所有用户出错");
        }

        return "success";
    }
}
